    //
//  UserSlidePageViewController.m
//  ActiveDeck
//
//  Created by Chiao-Wei Liu on 2011/2/15.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "UserSlidePageViewController.h"
#import "AD_Image.h"
#import "AD_Page.h"

@implementation UserSlidePageViewController


 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
/*
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization.
    }
    return self;
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [self addImage];
    
   // imageBG.image = [UIImage imageWithData:[NSData dataWithContentsOfFile:[[pageOB.mut_Arr_Images objectAtIndex:0] imagePath]]];

	UISwipeGestureRecognizer *rightRecognizer;
	UISwipeGestureRecognizer *leftRecognizer;
	rightRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFromRight:)];
	[rightRecognizer setDirection:(UISwipeGestureRecognizerDirectionRight)];
	
    
	leftRecognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFromLeft:)];
	[leftRecognizer setDirection:(UISwipeGestureRecognizerDirectionLeft)];

    [[self view] addGestureRecognizer:rightRecognizer];
	[[self view] addGestureRecognizer:leftRecognizer];
    [leftRecognizer release]; 
    [rightRecognizer release]; 
	
    [super viewDidLoad];
}



-(void)handleSwipeFromRight:(UISwipeGestureRecognizer *)recognizer 
{
	NSLog(@"Swipe Right received.");
	NSLog(@"View Count:%d", [self.view retainCount]);

    if(canNavigateBackwards){
        [self loadPrePage];
    }
}

-(void)handleSwipeFromLeft:(UISwipeGestureRecognizer *)recognizer 
{
	NSLog(@"Swipe Left received.");
	NSLog(@"View Count:%d", [self.view retainCount]);

    if(canNavigateForwards){
        [self loadNextPage];
    }
}
				  


- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}


- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [pageImage release];
    [super dealloc];
}


@end
